package database;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Conexao {
	public static Connection getConexao() {  
		try {  
			String driverName = "com.mysql.jdbc.Driver";                          
			Class.forName(driverName);
			
			String serverName = "localhost";  
			String mydatabase = "rjx";  
			String url = "jdbc:mysql://" + serverName + "/" + mydatabase;  
			String username = "rjx";        
			String password = "senhadorjx";  
			Connection connection = DriverManager.getConnection(url, username, password);  
			return connection;
		}  catch (ClassNotFoundException e) {  
			System.out.println("O driver expecificado nao foi encontrado.");  
			return null;  
		} catch (SQLException e) {  
			System.out.println("Nao foi possivel conectar ao Banco de Dados.");  
			return null;  
		}  
	}
}